package com.share.design.command;

import java.util.ArrayList;
import java.util.List;

/**
 * author:caifan
 * date:2020/2/3
 */
public class Waiter {
    private List<Command> commandList = new ArrayList<>();

    /**
     * 设置订单
     * @param command
     */
    public void setOrder(Command command) {
        if (command instanceof BakeMuttonCommand || command instanceof BakeChickenWingCommand) {
            commandList.add(command);
        } else {
            System.out.println("肉没了");
        }
    }

    /**
     * 通知执行者执行
     */
    public void notifyExecute() {
        for (Command command : commandList) {
            command.executeCommand();
        }
    }
}
